import XLSX from 'xlsx';

const htmlToExcel = {
  getExcel(dom, title = 'temp'){
    var excelTitle = title;
    var wb = XLSX.utils.table_to_book(document.querySelector(dom));
    try {
      XLSX.writeFile(wb, excelTitle + '.xlsx');
    } catch (e) {
      if (typeof console !== 'undefined') {
        console.log(e);
        alert('导出失败!');
      }
    }
    // return wbout;
  },
};

export default htmlToExcel;
